package com.carcontrol.myplugin4.utils;


import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


public class ReflectUtil {
	public static Object getField(Object obj, Class cls, String str) throws NoSuchFieldException, IllegalAccessException {
		Field declaredField = cls.getDeclaredField(str);
		declaredField.setAccessible(true);
		return declaredField.get(obj);
	}

	public static void setField(Object obj, Class cls, String str, Object obj2) throws NoSuchFieldException, IllegalAccessException {
		Field declaredField = cls.getDeclaredField(str);
		declaredField.setAccessible(true);
		declaredField.set(obj, obj2);
	}

	public static void invokeMethod(Object obj, Class cls, String str, Class pc, Object obj2) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
		Method declaredMethod = cls.getDeclaredMethod(str, pc);
		declaredMethod.setAccessible(true);
		declaredMethod.invoke(obj, obj2);
	}
}
